
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<%@page import="com.tss.util.*"%>
<%@page import="com.jedi.*"%>
<%@page import="com.store.*"%>
<%@page import="java.util.*"%>
<%@page import="java.text.*"%>
<%@include file="../global_var.jsp"%>
<%@include file="../check_login.jsp"%>
<%
User just_user = (User)session.getAttribute("LoginUser");
String power_enable_id = "10401";

if (!just_user.hasPower(power_enable_id)) {
	out.println(strNoPowerInfo); 
	return;
}
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";


ApproveExpMgr approveMgr = new ApproveExpMgr();
UserMgr userMgr = new UserMgr();
List list = null;

String user_id = ParamUtils.getParameter(request,"user_id","");
String b_year = ParamUtils.getParameter(request,"b_year","2006");
String e_year = ParamUtils.getParameter(request,"e_year","2006");
String b_month = ParamUtils.getParameter(request,"b_month","01");
String e_month = ParamUtils.getParameter(request,"e_month","12");
%>
<html>
<head>
    <base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title>
<link href="style/main.css" rel="stylesheet" type="text/css">
<script language="javascript" src="js/common.js"></script>
<script language="javascript">
function clk_approve_show(id) {
	location.href = "approve_detail_show.jsp?list_id=" + id;
}

function clk_search() {
	var sForm = document.searchForm;
	try {
		var oForm = document.pageForm;
		oForm.user_id.value = sForm.user_id.options[sForm.user_id.selectedIndex].value;
		oForm.b_year.value = sForm.b_year.options[sForm.b_year.selectedIndex].value;
		oForm.e_year.value = sForm.e_year.options[sForm.e_year.selectedIndex].value;
		oForm.b_month.value = sForm.b_month.options[sForm.b_month.selectedIndex].value;
		oForm.e_month.value = sForm.e_month.options[sForm.e_month.selectedIndex].value;
		oForm.submit();
	}
	catch(ex) {
		//alert(ex.description);
		sForm.submit();
	}
}
</script>
</head>
<body  leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td style="padding-left:25px;">
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td height="31" valign="top" background="images/title_bk_01.gif" style="padding-left:10px;padding-top:6px;">
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="50%" style="color:#FFFFFF;font-size:13px;">
                  <b>客户满意度</b> -&gt; 
                  <b>明细列表</b>
                </td>
                <td width="50%" align="right" style="padding-right:10px;">&nbsp;
                  &nbsp;
                </td>
              </tr>
            </table>
          </td>
        </tr>
        <tr> 
          <td height="100" align="right" valign="top" style="padding-top:12px;padding-bottom:10px;padding-right:5px;"> 
             <form name="searchForm" method="post">
            <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
            
              <tr bgcolor="#EDEDF0"> 
                <td height="30" style="padding-left:10px;" colspan="4">
                  <select name="user_id">
                    <option value="">全部</option>
                    <%
                    List userList = userMgr.get(" and a.role_id = '" + architect_role_id + "'","user_id");
                    if (userList != null && userList.size() > 0) {
                    	for(int i=0;i<userList.size();i++) {
                    		User item = (User)userList.get(i);
                    %>
                    <option value="<%=item.getId()%>"<%if (item.getId().equals(user_id)){%> selected<%}%>><%=item.getUserName()%></option>
                    <%}}%>
                  </select> &nbsp;&nbsp; 从
                  <select name="b_year">
                    <%
                    int yearNum = Calendar.getInstance().get(Calendar.YEAR);
                    for(int i= yearNum - 5;i <= yearNum;i++) {
                    %>
                    <option value="<%=i%>"<%if (b_year.trim().equals(i+"")){%> selected<%}%>><%=i%></option>
                    <%}%>
                  </select> 年 &nbsp; 
                  <select name="b_month">
                    <option value="01"<%if (b_month.trim().equals("01")){%> selected<%}%>>1</option>
                    <option value="02"<%if (b_month.trim().equals("02")){%> selected<%}%>>2</option>
                    <option value="03"<%if (b_month.trim().equals("03")){%> selected<%}%>>3</option>
                    <option value="04"<%if (b_month.trim().equals("04")){%> selected<%}%>>4</option>
                    <option value="05"<%if (b_month.trim().equals("05")){%> selected<%}%>>5</option>
                    <option value="06"<%if (b_month.trim().equals("06")){%> selected<%}%>>6</option>
                    <option value="07"<%if (b_month.trim().equals("07")){%> selected<%}%>>7</option>
                    <option value="08"<%if (b_month.trim().equals("08")){%> selected<%}%>>8</option>
                    <option value="09"<%if (b_month.trim().equals("09")){%> selected<%}%>>9</option>
                    <option value="10"<%if (b_month.trim().equals("10")){%> selected<%}%>>10</option>
                    <option value="11"<%if (b_month.trim().equals("11")){%> selected<%}%>>11</option>
                    <option value="12"<%if (b_month.trim().equals("12")){%> selected<%}%>>12</option>
                  </select> 月 --> &nbsp;
                  <select name="e_year">
                    <%
                    for(int i= yearNum - 5;i <= yearNum;i++) {
                    %>
                    <option value="<%=i%>"<%if (e_year.trim().equals(i+"")){%> selected<%}%>><%=i%></option>
                    <%}%>
                  </select> 年 &nbsp; 
                  <select name="e_month">
                    <option value="01"<%if (e_month.trim().equals("01")){%> selected<%}%>>1</option>
                    <option value="02"<%if (e_month.trim().equals("02")){%> selected<%}%>>2</option>
                    <option value="03"<%if (e_month.trim().equals("03")){%> selected<%}%>>3</option>
                    <option value="04"<%if (e_month.trim().equals("04")){%> selected<%}%>>4</option>
                    <option value="05"<%if (e_month.trim().equals("05")){%> selected<%}%>>5</option>
                    <option value="06"<%if (e_month.trim().equals("06")){%> selected<%}%>>6</option>
                    <option value="07"<%if (e_month.trim().equals("07")){%> selected<%}%>>7</option>
                    <option value="08"<%if (e_month.trim().equals("08")){%> selected<%}%>>8</option>
                    <option value="09"<%if (e_month.trim().equals("09")){%> selected<%}%>>9</option>
                    <option value="10"<%if (e_month.trim().equals("10")){%> selected<%}%>>10</option>
                    <option value="11"<%if (e_month.trim().equals("11")){%> selected<%}%>>11</option>
                    <option value="12"<%if (e_month.trim().equals("12")){%> selected<%}%>>12</option>
                  </select> 月
                  <input type="button" name="button" value="搜　索" class="inputButton" onclick="clk_search();"> 
                </td>
              </tr>
              
            </table>
            
            </form>
            <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#FFFFFF">
              <tr bgcolor="#858585" align="center"> 
                <td height="24" width="15%" style="color:#FFFFFF;"><b>工程师</b></td>
                <td width="10%" style="color:#FFFFFF;"><b>打分</b></td>
                <td width="15%" style="color:#FFFFFF;"><b>项目名称</b></td>
                <td width="20%" style="color:#FFFFFF;"><b>日期</b></td>
                <td width="15%" style="color:#FFFFFF;"><b>销售</b></td>
                <td width="15%" style="color:#FFFFFF;"><b>客户</b></td>
                <td width="10%" style="color:#FFFFFF;"><b>操作</b></td>
             </tr>
              <%
              String b_time = b_year + "-" + b_month;
              String e_time = e_year + "-" + e_month;
              String otherSQL = " and substring(exp_time for 7) >= '" + b_time + "'";
              otherSQL += " and substring(exp_time for 7) <= '" + e_time + "'";
              if (user_id != null && !user_id.trim().equals("")) 
              	otherSQL += " and user_id = '" + user_id + "'";
              String orderField = "exp_time desc";
              int pageSize = 10;
              int pageNo = ParamUtils.getIntParameter(request,"page",1);
              list = approveMgr.get(otherSQL,orderField,pageNo,pageSize);
              int total = approveMgr.getTotal(); 
              boolean b=(total % pageSize ==0);
              int pageCount=b?(total/pageSize):(total/pageSize +1);
              if(pageNo>pageCount){
              	pageNo=pageCount;
              }
              if (list != null && list.size() > 0) {
              	String bgColor[] = {"#EDEDF0","#D7D7DB"};
              	for(int i=0;i<list.size();i++) {
              		ApproveExp item = (ApproveExp)list.get(i);
              %>
              <tr bgcolor="<%=bgColor[i%2]%>" align="center"> 
                <td height="24"><a href="approve_mgt/approve_detail_view.jsp?list_id=<%=item.getId()%>"><%=item.getUserName()%></a></td>
                <td><%=item.getApproveVal()%></td>
                <td><%=item.getProject_name()%></td>
                <td><%=item.getExpTime()%></td>
                <td><%=(item.getAppealSales() == 1) ? "投诉":"未投诉"%></td>
                <td><%=(item.getAppealCust() == 1) ? "投诉":"未投诉"%></td>
                <td><span onclick="clk_approve_show('<%=item.getId()%>');" style="cursor:hand;text-decoration: underline;">操作</span></td>
              </tr>
            <%	}%>
            </table>
               <form name="pageForm" method="post">
            <table width="100%" border="0" cellpadding="0" cellspacing="0" background="images/page_img/page_bk.gif">
           
              <tr height="32" align="center" valign="bottom"> 
                <td width="5%">
                  <img src="images/page_img/page_tag_01.gif">
                  <input type="hidden" name="user_id" value="<%=user_id%>">
                  <input type="hidden" name="b_year" value="<%=b_year%>">
                  <input type="hidden" name="e_year" value="<%=e_year%>">
                  <input type="hidden" name="b_month" value="<%=b_month%>">
                  <input type="hidden" name="e_month" value="<%=e_month%>">
                </td>
                <td height="35" align="right" style="padding-right:10px;" valign="bottom" id="pannelPageInfo">&nbsp;</td>
              </tr>
           
            </table>
               </form>
            <script language="javascript">
            pannelPageInfo.innerHTML = getPageInfo(<%=total%>,<%=pageSize%>,<%=pageNo%>,5,'images/page_img','pageForm');
            </script>
            <%}else{%>
            <table width="95%" border="0" cellpadding="4" cellspacing="1" bgcolor="#FFFFFF">
              <tr> 
                <td height="60" align="center">没有搜索到相关记录!</td>
              </tr>
            </table>
            <%}%>
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
</body>
</html>
